﻿'    DotNetIRCD - An IRC Daemon written in VB.Net
'    Copyright (C) 2012 GeorgeBush
'
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.
'
'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with this program. If not, see <http://www.gnu.org/licenses/>.

''' <summary>
''' This Module holds the list of accepted User Commands
''' </summary>
<HideModuleName()> _
Module UserCommandsModule

    ''' <summary>
    ''' Structure to hold the definition of a User Command
    ''' </summary>
    Public Structure UserCommand

        ''' <summary>
        ''' The Command
        ''' </summary>
        Public Command As String

        ''' <summary>
        ''' The Command's Syntax
        ''' </summary>
        Public Syntax() As String

        ''' <summary>
        ''' A Description of the Command
        ''' </summary>
        Public Description() As String

        ''' <summary>
        ''' Create a new instance of the UserCommand Structure
        ''' </summary>
        ''' <param name="Command">The Command</param>
        ''' <param name="Syntax">The Command's Syntax</param>
        ''' <param name="Description">A Description of the Command</param>
        Sub New(ByVal Command As String, ByVal Syntax() As String, ByVal Description() As String)

            Me.Command = Command
            Me.Syntax = Syntax
            Me.Description = Description

        End Sub

    End Structure

    ''' <summary>
    ''' The list of accepted User Commands
    ''' </summary>
    Public UserCommands() As UserCommand = _
        {New UserCommand("ADMIN",
                         {"ADMIN <Server>"},
                         {"Provides Administrative information regarding the server."}),
         New UserCommand("AWAY",
                         {"AWAY <Reason>",
                          "Example: /AWAY Lunch time!"},
                         {"Sets your online status to 'Away'."}),
         New UserCommand("CREDITS",
                         {"CREDITS <Server>"},
                         {"Lists credits for everyone that has helped create DotNetIRCD"}),
         New UserCommand("CYCLE",
                         {"CYCLE <Chan1>,<Chan2>,<Chan3>..."},
                         {"Cycles the given channel(s). This command is equivalent to sending a PART then a JOIN command"}),
         New UserCommand("DCCALLOW",
                         {"/DCCALLOW [<+|->nick[,<+|->nick, ...]] [list] [help]"},
                         {"You may allow DCCs of files which are otherwise blocked by the IRC server",
                          "by specifying a DCC allow for the user you want to receive files from.",
                          "For instance, to allow the user Bob to send you file.exe, you would type:",
                          "/DCCALLOW +bob",
                          "and Bob would then be able to send you files. Bob will have to resend the file",
                          "if the server gave him an error message before you added him to your allow list.",
                          "/DCCALLOW -bob",
                          "Will do the exact opposite, removing him from your DCC allow list.",
                          "/DCCALLOW list",
                          "Will list the users currently on your DCC allow list."}),
         New UserCommand("INVITE",
                         {"INVITE [<user> <channel>]",
                          "Example: /INVITE Bob #Channel"},
                         {"Sends a user an Invitation to join a particular channel.",
                          "If the channel is +i, you must be an Operator to use this",
                          "command, otherwise any user may use the command.",
                          "Invite without parameters lists the channels you have been",
                          "invited to."}),
         New UserCommand("ISON",
                         {"ISON <Nick1> <Nick2> <Nick3> <Nick4>"},
                         {"Used to determine if certain user(s) are",
                          "currently online based upon their nickname."}),
         New UserCommand("JOIN",
                         {"JOIN <Chan1>,<Chan2>,<Chan3> <Key1>,<Key2>,<Key3>",
                          "Example: /JOIN #Support",
                          "Example: /JOIN #Lobby,#IRCd",
                          "Example: /JOIN #IRCd,#Support,#main letmein,somepass,anotherpass"},
                         {"Used to enter one or more channels on an IRC server.",
                          "All occupants of the channel will be notified of your arrival.",
                          "JOIN with 0 as a parameter makes you Part all channels.",
                          "If you specify one or more keys, they will be used to join a +k channel"}),
         New UserCommand("KICK",
                         {"KICK <channel> <user> [reason]",
                          "Example: /KICK #Lobby L33t Lamer.."},
                         {"Removes a user from a channel. Can only be used by Operators",
                          "or Half-Ops. If no reason is specified, your nickname becomes the reason."}),
         New UserCommand("KNOCK",
                         {"KNOCK <channel> <message>",
                          "Example: /KNOCK #secret_chan I'm an op, let me in!"},
                         {"For channels which are invite only, you can 'Knock' on the",
                          "channel to request an invite."}),
         New UserCommand("LICENSE",
                         {"LICENSE",
                          "LICENSE <server>"},
                         {"This command displays information about the license UnrealIRCd is released under."}),
         New UserCommand("LINKS",
                         {"LINKS"},
                         {"Lists all of the servers currently linked to the network.",
                          "Only IRCops can see linked U:lined servers."}),
         New UserCommand("LIST",
                         {""},
                         {"Provides a complete listing of all channels on the network.",
                          "If a search string is specified, it will only show those",
                          "matching the search string.",
                          "",
                          "Some additional flags are also supported.",
                          ">number  List channels with more than <number> people",
                          "<number  List channels with less than <number> people",
                          "!*mask*  List channels that do not match *mask*"}),
         New UserCommand("LUSERS",
                         {"LUSERS [server]"},
                         {"Provides Local and Global user information",
                          "(Such as Current and Maximum user count)."}),
         New UserCommand("MAP",
                         {"MAP"},
                         {"Provides a graphical 'Network Map' of the IRC network.",
                          "Mainly used for routing purposes."}),
         New UserCommand("MODE",
                         {"MODE <channel/user> <mode>",
                          "Example: /MODE #Support +tn",
                          "Example: /MODE #Support +otn hAtbLaDe XYZ"},
                         {"Sets a Mode on the specified Channel or User",
                          "Use /HELPOP CHMODES or /HELPOP UMODES to see a list of Modes"}),
         New UserCommand("MODULE",
                         {"MODULE",
                          "MODULE <Server>"},
                         {"This will give you a list of all modules loaded.",
                          "Depending on whether you are a normal user or an Oper",
                          "it will give different output.",
                          "",
                          "-- normal user: --",
                          "Output of command: *** name - (description) [3RD]",
                          "the [3RD] flag is present if it's an 3rd party module.",
                          "",
                          "-- IRCOp: -- ",
                          "Output of command: *** name - version (description) [optional flags]",
                          "flags can be:",
                          "[PERM]: permanent module (not possible to unload/reload)",
                          "[Unloading]: module is in the process of unloading",
                          "[3RD] 3rd party module"}),
         New UserCommand("MOTD",
                         {"MOTD",
                          "MOTD <Server>"},
                         {"Displays the Message Of The Day of the IRC Server you are logged onto",
                          "or the specified Server"}),
         New UserCommand("NAMES",
                         {"NAMES <Channel>",
                          "Example: /NAMES #Support"},
                         {"Provides a list of users on the specified channel."}),
         New UserCommand("NICK",
                         {"NICK <new nickname>",
                          "Example: /NICK L33tIRC"},
                         {"Changes your 'Online Identity' on a server."}),
         New UserCommand("NOTICE",
                         {"NOTICE <Nick> <Text>",
                          "NOTICE <#Channel> <Text>",
                          "NOTICE <Prefix><#Channel> Text>",
                          "NOTICE $<Mask> <Text>"},
                         {"Send a notice to a user, channel or server.",
                          "/NOTICE <Nick> <text>",
                          "Send a notice to a user.",
                          "Ex: /NOTICE Blah hi, how are you?",
                          "",
                          "/NOTICE <#Channel> <text>",
                          "Send a notice to a channel.",
                          "Ex: /NOTICE #room Hi all, this is annoying",
                          "",
                          "/NOTICE <Prefix><#Channel> <Text>",
                          "Send a notice to users with <Prefix> and higher in <#Channel> only",
                          "Ex: /NOTICE @#room This goes to +oaq",
                          "EX: /NOTICE +#room This goes to +vhoaq",
                          "NOTE: You need at least voice in order to send to +#Channel/%#Channel/@#Channel",
                          "and at least ops to send to &#Channel/~#Channel.",
                          "",
                          "/NOTICE $<mask> <text>",
                          "Send a notice to all users on servers matching <mask> [Oper only]",
                          "This is shown in the status window by most clients.",
                          "Ex: /NOTICE $*.mynet.net We will be upgrading our net in the next hour",
                          "Note that in most cases services (/OS GLOBAL) is a better alternative.",
                          "",
                          "Multiple targets are also supported, like /NOTICE <Nick1>,<Nick2>,<Nick3>."}),
         New UserCommand("PART",
                         {"PART <Channel1>,<Channel2>,<Channel3>, ... <Reason>",
                          "Example: /PART #Support",
                          "Example: /PART #Lobby,#IRCd See you later"},
                         {"Used to part (or leave) a channel you currently occupy.",
                          "All those in the channel will be notified of your departure.",
                          "If you specify a reason it will be displayed to the users on the channel"}),
         New UserCommand("PING",
                         {"PING <Nick>/<Server>",
                          "Example: /PING irc.fyremoon.net",
                          "Example: /PING hAtbLaDe",
                          "Example: /PING hAtbLaDe irc2.dynam.ac"},
                         {"The PING command is used to test the presence of an active client or",
                          "server at the other end of the connection.  Servers send a PING",
                          "message at regular intervals if no other activity detected coming",
                          "from a connection.  If a connection fails to respond to a PING",
                          "message within a set amount of time, that connection is closed. A",
                          "PING message MAY be sent even if the connection is active.",
                          "Note that this is different from a CTCP PING command.."}),
         New UserCommand("PONG",
                         {"/PONG <Server> <Server2>",
                          "Example: PONG irc.fyremoon.net irc2.dynam.ac",
                          "Example: /PONG hAtbLaDe"},
                         {"PONG message is a reply to PING message.  If parameter <server2> is",
                          "given, this message will be forwarded to given target.  The <server>",
                          "parameter is the name of the entity who has responded to PING message",
                          "and generated this message."}),
         New UserCommand("PRIVMSG",
                         {"PRIVMSG <Nick> <Message>",
                          "PRIVMSG <#Channel> <Message>",
                          "PRIVMSG <Prefix><#Channel> <Message>",
                          "PRIVMSG $<Mask> <Message>"},
                         {"Send a message to a user, channel or server.",
                          "",
                          "/PRIVMSG <Nick> <Message>",
                          "Send a private message.",
                          "Ex: /PRIVMSG Blah hi, how are you?",
                          "",
                          "/PRIVMSG PRIVMSG <#Channel> <Message>",
                          "Send a message to a channel.",
                          "Ex: /PRIVMSG #room Hi all",
                          "",
                          "/PRIVMSG <Prefix><#Channel> <Message>",
                          "Send a message to users with <prefix> and higher in <#channel> only",
                          "Ex: /PRIVMSG @#room This goes to +oaq",
                          "Ex: /PRIVMSG +#room This goes to +vhoaq",
                          "NOTE: You need at least voice in order to send to +#Channel/%#Channel/@#Channel",
                          "and at least ops to send to &#Channel/~#Channel.",
                          "",
                          "PRIVMSG $<Mask> <Message>",
                          "Send a message to all users on servers matching <mask> [Oper only]",
                          "This is shown in the status window by most clients.",
                          "Ex: /PRIVMSG $*.mynet.net We will be upgrading our net in the next hour",
                          "Note that in most cases services (/OS GLOBAL) is a better alternative.",
                          "",
                          "Multiple targets are also supported, like /PRIVMSG <Nick1>,<Nick2>,<Nick3>."}),
         New UserCommand("QUIT",
                         {"QUIT <Reason>",
                          "Example: QUIT Leaving!"},
                         {"Disconnects you from the IRC server. Those in the",
                          "channels you occupy will be notified of your departure.",
                          "If you do not specify a reason, your nickname becomes the reason."}),
         New UserCommand("RULES",
                         {"RULES",
                          "RULES <Server>"},
                         {"Shows you the Rules of the Network."}),
         New UserCommand("SETNAME",
                         {"SETNAME <New Real Name>"},
                         {"Allows users to change their 'Real name' (GECOS)",
                          "directly online at IRC without reconnecting"}),
         New UserCommand("SILENCE",
                         {"SILENCE +Nickname",
                          "SILENCE -Nickname",
                          "SILENCE"},
                         {"Ignores messages from a user or list of users at the Server itself.",
                          "",
                          "/SILENCE +Nickname",
                          "Adds a Nickname to the SILENCE List",
                          "",
                          "/SILENCE -Nickname",
                          "Removes a Nickname from the SILENCE List",
                          "",
                          "/SILENCE",
                          "Lists the current SILENCE List"}),
         New UserCommand("STATS",
                         {"STATS <flags>",
                          "Example: STATS u"},
                         {"Provides certain Statistical information about the server.",
                          "Type /stats without parameters to get a list of available flags."}),
         New UserCommand("TIME",
                         {"TIME",
                          "TIME <server>"},
                         {"Displays the current Server Date and Time."}),
         New UserCommand("TOPIC",
                         {"TOPIC <Channel>",
                          "TOPIC <Channel> <Topic>"},
                         {"Sets/Changes the topic of the channel in question,",
                          "or just display the current Topic."}),
         New UserCommand("USERHOST",
                         {"USERHOST <nickname>",
                          "Example: /USERHOST hAtbLaDe"},
                         {"Returns the Host of the user in question.",
                          "Usually used by scripts or bots."}),
         New UserCommand("USERIP",
                         {"USERIP <nickname>",
                          "Example: /USERIP neocortex"},
                         {"Returns the IP of the user in question.",
                          "Usually used by scripts or bots."}),
         New UserCommand("VERSION",
                         {"VERSION",
                          "/VERSION <server>"},
                         {"Provides Version information of the IRCd software in usage."}),
         New UserCommand("VHOST",
                         {"VHOST <Login> <Password>",
                          "Example: VHOST GeorgeBush iloveusa"},
                         {"Hides your real hostname with a virtual hostname",
                          "provided by the IRC server , using SETHOST."}),
         New UserCommand("WATCH",
                         {"WATCH +nick1 +nick2 +nick3",
                          "WATCH -nick",
                          "WATCH"},
                         {"Watch is a notify-type system on the server which is both faster",
                          "and uses less network resources than any old-style notify",
                          "system. The server will send you a message when any nickname",
                          "in your watch list logs on or off.",
                          "The watch list DOES NOT REMAIN BETWEEN SESSIONS - You (or your",
                          "script or client) must add the nicknames to your watch list every",
                          "time you connect to an IRC server.",
                          "",
                          "Example: /WATCH +neocortex",
                          "Adds neocortex to the WATCH List",
                          "",
                          "Example: /WATCH -neocortex",
                          "Removes neocortex from the WATCH List",
                          "",
                          "Example: /WATCH",
                          "Shows the WATCH List"}),
         New UserCommand("WHO",
                         {"WHO [+|-][acghimnsuMRI] [args]"},
                         {"",
                          "Flags are specified like channel modes, the flags cgmnsu all have arguments",
                          "Flags are set to a positive check by +, a negative check by -",
                          "",
                          "The flags available:",
                          "Flag a: user is away",
                          "Flag c <channel>: user is on <channel>, no wildcards accepted",
                          "Flag g <gcos/realname>: user has string <gcos> in his/her GCOS,",
                          "wildcards accepted, oper only",
                          "Flag h <host>: user has string <host> in his/her hostname, wildcards are accepted",
                          "Flag i <ip>: user has string <ip> in his/her IP address",
                          "Flag m <usermodes>: user has <usermodes> set, only o/C/A/a/N for nonopers",
                          "Flag n <nick>: user has string <nick> in his/her nickname, wildcards accepted",
                          "Flag s <server>: user is on server <server>, wildcards not accepted",
                          "Flag u <user>: user has string <user> in his/her username, wildcards accepted",
                          "",
                          "Behaviour flags:",
                          "Flag M: check for user in channels I am a member of",
                          "Flag R: show users' real hostnames",
                          "Flag I: show users' IP addresses",
                          "",
                          "For backwards compatibility, /who 0 o still shows +o users",
                          "Example: WHO +m o",
                          "",
                          "Status flags:",
                          "The who command shows several flags in the returned result to indicate",
                          "different information about the user. These flags are explained below:",
                          "G - User is /away (gone)",
                          "H - User is not /away (here)",
                          "r - User is using a registered nickname",
                          "B - User is a bot (+B)",
                          "* - User is an IRC Operator",
                          "~ - User is a Channel Owner (+q)",
                          "& - User is a Channel Admin (+a)",
                          "@ - User is a Channel Operator (+o)",
                          "% - User is a Half-Op (+h)",
                          "+ - User is Voiced (+v)",
                          "! - User is +H and you are an IRC Operator",
                          "? - User is only visible because you are an IRC Operator"}),
         New UserCommand("WHOIS",
                         {"WHOIS <UserNickname>",
                          "Example: WHOIS GeorgeBush"},
                         {"Shows information about the user in question,",
                          "such as their 'Name', channels they are",
                          "currently in, their hostmask, etc.",
                          "",
                          "Status flags:",
                          "The list of channels shown in the WHOIS reply can include one or more",
                          "status flags to indicate information about the channel. These flags are",
                          "described below:",
                          "~ - User is a Channel Owner (+q)",
                          "& - User is a Channel Administrator (+a)",
                          "@ - User is a Channel Operator (+o)",
                          "% - User is a Half-Op (+h)",
                          "+ - User is Voiced (+v)",
                          "! - User has channels hidden in whois (+p) and you are an IRC Operator",
                          "? - The channel is secret (+s) and you are an IRC Operator"}),
         New UserCommand("WHOWAS",
                         {"WHOWAS <Nickname>",
                          "WHOWAS <Nickname> <max number of replies>",
                          "Example: /WHOWAS GeorgeBush"},
                         {"Retrieves previous WHOIS information for users",
                          "no longer connected to the server."})}

End Module